package zhieasy.cn.xpu_helper.controller.common;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zhieasy.cn.common.utils.result.ResultUtils;
import zhieasy.cn.common.vo.ResultVO;
import zhieasy.cn.model.common.Ad;
import zhieasy.cn.service.common.AdService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(value = "common模块，广告接口")
@RestController
@RequestMapping("/common/ad")
public class AdController {

    @Autowired
    AdService adService;

    @ApiOperation(value = "获取首页的广告数组")
    @RequestMapping(value = "")
    public ResultVO getCommonAd(){
        List<Ad> ads = adService.listByMap(new HashMap<String, Object>() {{
            put("type", 0);
            put("is_delete",1);
        }});
        return ResultUtils.success(ads);
    }

}
